<?php
if (!isset($_GET["imp"])){
echo '<input type="button" value="Exportar PDF" onclick="location.href='.chr(39).'facte.php?imp=PDF'.chr(39).'">';
$xsl_filename="imp_factnva.xsl";
$xml_filename="12708-FE.xml";
$xsl = new XSLTProcessor();
$xsl->importStyleSheet(DOMDocument::load($xsl_filename));
echo $xsl->transformToXML(DOMDocument::load($xml_filename));
}else{
ob_start();
echo '<style type="text/css">';
echo ' body {font-size: 10px}';
echo '</style>';
echo '<page backtop="30mm" backbottom="10mm" backleft="0mm" backright="0mm">';
$xsl_filename="imp_factnva_modificada.xsl";
$xml_filename="12708-FE.xml";
$xsl = new XSLTProcessor();
$xsl->importStyleSheet(DOMDocument::load($xsl_filename));
echo $xsl->transformToXML(DOMDocument::load($xml_filename));
echo '</page>';
$content = ob_get_clean();
require_once(dirname(__FILE__).'/html2pdf_v4.01/html2pdf.class.php');
	try
	{
		$html2pdf = new HTML2PDF('P','A3', 'es', false, 'ISO-8859-15', 3);
		$html2pdf->pdf->SetDisplayMode('fullpage');
		
		$html2pdf->setTestTdInOnePage(false); //esto  bloquea el error del tag TD
		
		$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
		$html2pdf->Output('reporte_salida.pdf');
	}
	catch(HTML2PDF_exception $e) { echo $e; }
}
?>